﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using System.Web.Http.Results;

namespace WebApiDemo.CustomResponses
{
    public class BetterNotFoundResult : NotFoundResult
    {
        private string _message;
        public BetterNotFoundResult(String message, ApiController controller)
            : base(controller)
        {
            _message = message;
        }
        public BetterNotFoundResult(String message, HttpRequestMessage request): base(request)
        {
            _message = message;
        }
        public override Task<HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken)
        {
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.NotFound, _message);

            return Task.FromResult(response);
        }
    }
}